<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Seller\Controller;
use Think\Controller;
class ShopController extends \Member\Controller\IndexController {
	
	public function shopinit($iscertificate=0){
		$this->assign('isshowuploadlist',1);
		$shopmodel=new \Member\Model\ShopCertificateModel();
		$certificate=$shopmodel->GetCertificate($this->uid);
		//认证状态
		if(!$iscertificate && !empty($certificate['id'])){
			
			$this->assign('certificate',$certificate);
			
			if($certificate['status']>0 && ACTION_NAME!='check'){
				$this->redirect('/seller/shop/check');
			}
		}
		
		if($iscertificate && intval($certificate['status'])!=5){
			$this->error('对不起，请认证后操作！','/seller/shop',3);
			exit();
		}
	}
	
    public function indexAction(){
		$this->shopinit();
		$this->display();	
    }
	
	//认证
	public function authAction(){
		$this->shopinit();
		$this->display();
	}
	
	//审核
	public function checkAction(){
		$this->shopinit();
		$this->display();
	}
	
	public function logoAction(){
		$this->shopinit(1);
		$this->display();	
    }
	
	public function slideAction(){
		$this->shopinit(1);
		$uploadsize=round(C('onefileuploadsize')/1024/1024,2);
		$this->assign('uploadsize',$uploadsize);
		$this->assign('uploadid','slide'); //设置上传文件字段
		
		//幻灯片
		$slidearray=M('ShopSlide')->token(false)->where(" uid=$this->uid ")->order('dateline ASC')->limit(3)->select();
		$this->assign('slidearray',$slidearray);
		
		$this->display();	
    }
}